package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class UserAttentionWeightUpdateRequest  extends Request {
	
	private static final long serialVersionUID = 1021722219799554265L;

	private int followedUserId;
	
	private int followUserId;
	
	private int weight;
	
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		
		this.followedUserId = requestInfo.getIntParameter(ApiUrlParamEnum.followedUserId.getParamName(),-1);
		this.followUserId = requestInfo.getIntParameter(ApiUrlParamEnum.followUserId.getParamName(), -1);
		this.weight = requestInfo.getIntParameter(ApiUrlParamEnum.weight.getParamName(), 0);
		if (followUserId < 1) {
			throw new RequestIllegalException("error followUserId: " + followUserId);
		}
		
		if (followedUserId < 1) {
			throw new RequestIllegalException("error followedUserId: " + followedUserId);
		}
		
	}

	public Integer getFollowedUserId() {
		return followedUserId;
	}

	public void setFollowedUserId(Integer followedUserId) {
		this.followedUserId = followedUserId;
	}

	public Integer getFollowUserId() {
		return followUserId;
	}

	public void setFollowUserId(Integer followUserId) {
		this.followUserId = followUserId;
	}

	public int getWeight() {
		return weight;
	}

	public void setWeight(int weight) {
		this.weight = weight;
	}

	public void setFollowedUserId(int followedUserId) {
		this.followedUserId = followedUserId;
	}

	public void setFollowUserId(int followUserId) {
		this.followUserId = followUserId;
	}

	
}
